package com.aaa.system.controller.api;

import com.aaa.entity.Menu;
import com.aaa.entity.User;
import com.aaa.system.service.MenuService;
import com.aaa.system.service.UserService;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: his-open-parent
 * @description:
 * @author: 闫克起2
 * @create: 2023-03-20 11:05
 **/
@RestController
@RequestMapping("system/api/menu")
public class ApiMenuController {

    @Autowired
    private MenuService menuService;
    @GetMapping("/leftMenu")
    public Result<List<Menu>> leftMenun(){
        return menuService.getLeftMenu();
    }

    @GetMapping("/list")
    public Result<List<Menu>> list(){
        return menuService.getAll();
    }

    @GetMapping("findByRoleId/{roleId}")
    public Result<List<Integer>> findByRoleId(@PathVariable Long roleId){
        return menuService.findByRoleId(roleId);
    }

    @PostMapping("confirmMenu")
    public Result<String> confirmMenu(Long roleId,Long[] menuIds){
        return menuService.confirmMenu(roleId,menuIds);
    }
}
